package com.yinlijun.websocket.protobuf;

/**
 * Brief: protobuf接口分装
 *
 * @author YinLijun <yinlijun2004@gmail.com>
 * @date created in 2020-11-19 14:49
 */
public class ProtoMsgHelper {
    public static ProtoMsg.Msg buildText(String content) {
        ProtoMsg.Text text = ProtoMsg.Text.newBuilder().setContent(content).build();
        return ProtoMsg.Msg.newBuilder()
                .setType(ProtoMsg.TYPE.TEXT)
                .setText(text)
                .build();
    }

    public static ProtoMsg.Msg buildEmoji(String content) {
        ProtoMsg.Emoji emoji = ProtoMsg.Emoji.newBuilder().setContent(content).build();
        return ProtoMsg.Msg.newBuilder()
                .setType(ProtoMsg.TYPE.EMOJI)
                .setEmoji(emoji)
                .build();
    }
}
